<?php
namespace Home\Model;
use Think\Model;


class ProductsModel extends Model {
    private $_db = '';

    public function __construct() {
        $this->_db = M('products');
    }
  public  function select($data,$limit=8){
       $conditions=$data;
       $conditions['status']=array('eq',1);
       $res =$this->_db->where($conditions)->order('listorder desc,products_id desc')->limit($limit)->select();
       return $res;

  }

/*  public function getNewsCount($data){
        $conditions=$data;
       $conditions['status']=array('neq',-1); 
       $res =$this->_db->where($conditions)->count();
       return $res; 
  }
 public  function  getNews($data,$page,$pageSize){
            $conditions=$data;
            $conditions['status'] = array('neq',-1);
            $offset=($page - 1) * $pageSize;
           $list= $this->_db->where($conditions)
           ->order('news_id desc')
            ->limit($offset,$pageSize)
            ->select();

         return $list;
 }
    public function find($id) {
        return $this->_db->where('news_id='.$id)->find();
    }*/


 }
    